package de.milo.map;

/**
 * Represents a rectangular viewport.
 * @author Mizi
 *
 */
public class ViewportInteger
{
	private int x;
	private int y;
	private int width;
	private int height;
	
	/**
	 * Creates a new viewport in the top left corner
	 * and a size of 1 by 1 pixels.
	 */
	public ViewportInteger()
	{
		this(0, 0, 1, 1);
	}
	
	/**
	 * Creates a new viewport at the given position and with
	 * the given size.
	 * @param x the x-position
	 * @param y the y-position
	 * @param width the width of the viewport
	 * @param height the height of the viewport
	 */
	public ViewportInteger(int x, int y, int width, int height)
	{
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
	}

	/**
	 * Returns the x-position of the viewport.
	 * @return x-position
	 */
	public int getX()
	{
		return x;
	}

	/**
	 * Returns the y-position of the viewport.
	 * @return y-position
	 */
	public int getY()
	{
		return y;
	}

	/**
	 * Returns the width of the viewport.
	 * @return the width of the viewport
	 */
	public int getWidth()
	{
		return width;
	}

	/**
	 * Returns the height of the viewport.
	 * @return the height of the viewport
	 */
	public int getHeight()
	{
		return height;
	}

	/**
	 * Sets the x-position of the viewport.
	 * @param x x-position
	 */
	public void setX(int x)
	{
		this.x = x;
	}

	/**
	 * Sets the y-position of the viewport.
	 * @param y y-position
	 */
	public void setY(int y)
	{
		this.y = y;
	}

	/**
	 * Sets the width of the viewport.
	 * @param width the width of the viewport
	 */
	public void setWidth(int width)
	{
		this.width = width;
	}

	/**
	 * Sets the height of the viewport.
	 * @param height the height of the viewport
	 */
	public void setHeight(int height)
	{
		this.height = height;
	}
	
	/**
	 * Sets the location of the viewport.
	 * @param x x-position
	 * @param y y-position
	 */
	public void setLocation(int x, int y)
	{
		setX(x);
		setY(y);
	}
	
	/**
	 * Sets the size of the viewport.
	 * @param width the width of the viewport
	 * @param height the height of the viewport
	 */
	public void setSize(int width, int height)
	{
		setWidth(width);
		setHeight(height);
	}
}
